{template 'common/header'}
{template 'common/common'}
{if $op == 'display'}
<link rel="stylesheet" href="../addons/wn_storex/template/style/css/membercard.css">
<div id="coupon_display">
	{template 'coupon_nav'}
	<div class="page-header clearfix">
		<h4 class="pull-left">卡券管理</h4>
		<div class="pull-right">
			<a href="javascript:;" id="add_coupon" class="btn btn-primary we7-padding-horizontal">+添加卡券</a>
		</div>
	</div>
	<div class="panel panel-default">
		<div class="panel-heading">
			<div class="weui-cell weui-cell_switch" style="width:300px;">
				<div class="weui-cell__bd"> 是否启用微信卡券：</div>
				<div class="weui-cell__ft">
					<label for="switchCP" class="weui-switch-cp">
						<input id="switchCP" class="weui-switch-cp__input" type="checkbox" name="flag" {if $setting['source'] == 2} checked="checked" {/if}>
						<div class="weui-switch-cp__box"></div>
					</label>
				</div>
			</div>
		</div>
	</div>
	<div class="modal fade" id="cardtype-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
					<h4 class="modal-title" id="myModalLabel">选择你要创建的卡券类型</h4>
				</div>
				<div class="modal-body clearfix form-horizontal">
					<div class="form-group marbot0">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
						<div class="col-sm-9 col-xs-12">
							<label class="radio-inline">
								<input type="radio" name="type" value="{COUPON_TYPE_DISCOUNT}"/> 折扣券
							</label>
							<div class="help-block">可为用户提供消费折扣</div>
						</div>
					</div>
					<div class="form-group marbot0">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
						<div class="col-sm-9 col-xs-12">
							<label class="radio-inline">
								<input type="radio" name="type" value="{COUPON_TYPE_CASH}"/> 代金券
							</label>
							<div class="help-block">可为用户提供抵扣现金服务。可设置成为“满*元，减*元”</div>
						</div>
					</div>
					{if COUPON_TYPE == WECHAT_COUPON}
					<div class="form-group marbot0">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
						<div class="col-sm-9 col-xs-12">
							<label class="radio-inline">
								<input type="radio" name="type" value="{COUPON_TYPE_GIFT}"/> 礼品券
							</label>
							<div class="help-block">可为用户提供消费送赠品服务</div>
						</div>
					</div>
					<div class="form-group marbot0">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
						<div class="col-sm-9 col-xs-12">
							<label class="radio-inline">
								<input type="radio" name="type" value="{COUPON_TYPE_GROUPON}"/> 团购券
							</label>
							<div class="help-block">可为用户提供团购套餐服务</div>
						</div>
					</div>
					<div class="form-group marbot0">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
						<div class="col-sm-9 col-xs-12">
							<label class="radio-inline">
								<input type="radio" name="type" value="{COUPON_TYPE_GENERAL}"/> 优惠券
							</label>
							<div class="help-block">即“通用券”，建议当以上四种无法满足需求时采用</div>
						</div>
					</div>
					{/if}
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
					<button type="button" class="btn btn-primary js-select-coupon" data-dismiss="modal">确定</button>
				</div>
			</div>
		</div>
	</div>
	<div class="modal fade" id="quantity-modal" tabindex="-1" role="dialog" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
					<h4 class="modal-title" id="myModalLabel">修改库存</h4>
				</div>
				<div class="modal-body clearfix form-horizontal">
					<input type="text" class="form-control" name="quantity" />
					<input type="hidden" name="quantity_coupon_id">
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
					<button type="button" class="btn btn-primary" data-dismiss="modal" onclick="util.ajaxshow('{php echo $this->createWeburl('couponmanage', array('op' => 'modifystock'))}&quantity=' + $('input[name=quantity]').val() + '&id='+ $('input[name=quantity_coupon_id]').val())">确定</button>
				</div>
			</div>
		</div>
	</div>
	<div class="modal fade" id="put-coupon">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-body">
					<div class="form-group">
						<ul class="nav nav-tabs" role="tablist">
						<li role="presentation" class="active"><a href="#put-qrcode" aria-controls="qrcode" role="tab" data-toggle="tab">二维码</a></li>
						<li role="presentation"><a href="#put-coupon-record" aria-controls="put-coupon-record" role="tab" data-toggle="tab">领取记录</a></li>
					</ul>
					</div>
					<div class="tab-content">
						<div role="tabpanel" class="tab-pane active text-center" id="put-qrcode">
							<div class="mui-content-padded mui-text-center">
								<div class="js-qrcode-block" style="margin:50px 0 50px 0"></div>
							</div>
						</div>
						<div role="tabpanel" class="tab-pane" id="put-coupon-record">
							<div class="alert alert-info text-left">
								共有 <span class="js-qrcode-record-total"></span> 人领取
							</div>
							<table class="table table-hover">
								<thead class="table table-hover">
									<tr>
										<th style="width: 20%;"></th>
										<th>昵称</th>
										<th style="width: 30%;">领取时间</th>
									</tr>
								</thead>
								<tbody class="js-qrcode-record"></tbody>
							</table>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div class="panel panel-info">
	<div class="panel-heading">筛选</div>
	<div class="panel-body">
		<form action="./index.php" method="get" class="form-horizontal" role="form">
		<input type="hidden" name="c" value="site" />
		<input type="hidden" name="a" value="entry" />
		<input type="hidden" name="do" value="couponmanage" />
		<input type="hidden" name="op" value="display" />
		<input type="hidden" name="m" value="wn_storex" />
		<input type="hidden" name="type" value="{$_GPC['type']}" />
			<div class="form-group">
				<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">卡券类型</label>
				<div class="col-sm-7 col-lg-9 col-xs-12 btn-group">
					<a href="{php echo filter_url('type:');}" class="btn {if $_GPC['type'] == ''}btn-primary{else}btn-default{/if}">不限</a>
					<a href="{php echo filter_url('type:'.COUPON_TYPE_DISCOUNT);}" class="btn {if $_GPC['type'] == COUPON_TYPE_DISCOUNT}btn-primary{else}btn-default{/if}">折扣券</a>
					<a href="{php echo filter_url('type:'.COUPON_TYPE_CASH);}" class="btn {if $_GPC['type'] == COUPON_TYPE_CASH}btn-primary{else}btn-default{/if}">代金券</a>
					{if COUPON_TYPE == WECHAT_COUPON}
					<a href="{php echo filter_url('type:'.COUPON_TYPE_GIFT);}" class="btn {if $_GPC['type'] == COUPON_TYPE_GIFT}btn-primary{else}btn-default{/if}">礼品券</a>
					<a href="{php echo filter_url('type:'.COUPON_TYPE_GROUPON);}" class="btn {if $_GPC['type'] == COUPON_TYPE_GROUPON}btn-primary{else}btn-default{/if}">团购券</a>
					<a href="{php echo filter_url('type:'.COUPON_TYPE_GENERAL);}" class="btn {if $_GPC['type'] == COUPON_TYPE_GENERAL}btn-primary{else}btn-default{/if}">优惠券</a>
					{/if}
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">审核状态</label>
				<div class="col-sm-7 col-lg-9 col-xs-12">
					<div class="btn-group">
						<a href="{php echo filter_url('status:');}" class="btn {if $_GPC['status'] == ''}btn-primary{else}btn-default{/if}">不限</a>
						<a href="{php echo filter_url('status:1');}" class="btn {if $_GPC['status'] == 1}btn-primary{else}btn-default{/if}">审核中</a>
						<a href="{php echo filter_url('status:2');}" class="btn {if $_GPC['status'] == 2}btn-primary{else}btn-default{/if}">未通过</a>
						<a href="{php echo filter_url('status:3');}" class="btn {if $_GPC['status'] == 3}btn-primary{else}btn-default{/if}">已通过</a>
					</div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">可用门店</label>
				<div class="col-sm-7 col-lg-9 col-xs-12">
					<select name="storeid" class="form-control">
						<option value="0">不限</option>
						{loop $store_lists $store}
							<option {if $_GPC['storeid'] == $store['id']}selected{/if} value="{$store['id']}">{$store['title']}</option>
						{/loop}
					</select>
				</div>
			</div>
			<div class="form-group">
				<label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label">券标题</label>
				<div class="col-sm-7 col-lg-9 col-xs-12">
					<input class="form-control" name="title" placeholder="券标题" type="text" value="{$_GPC['title']}">
				</div>
				<div class="pull-right col-xs-12 col-sm-3 col-lg-2">
					<button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
				</div>
			</div>
		</form>
	</div>
</div>
<div class="panel panel-default">
	<div class="table-responsive panel-body">
		<table class="table table-hover">
			<thead class="navbar-inner">
				<tr>
					<th width="80px">卡券类型</th>
					<th width="120px">卡券名称</th>
					<th width="150px">卡券有效期</th>
					<th width="70px">状态</th>
					<th width="100px">库存</th>
					<th width="50px">限领</th>
					<th width="80px">上架状态</th>
					<th style="width:450px; text-align:right;">操作</th>
				</tr>
			</thead>
			<tbody>
				{loop $couponlist $k $item}
				<tr>
					<td>{$item['type']['title']}</td>
					<td>{$item['title']}</td>
					<td>
						{$item['date_info']}
					</td>
					<td>
						{if $item['status'] == '1'}
						<span class="label label-info">审核中</span>
						{elseif $item['status'] == '2'}
						<span class="label label-danger">未通过</span>
						{elseif $item['status'] == '3'}
						<span class="label label-success">已通过</span>
						{elseif $item['status'] == '4'}
						<span class="label label-default">卡券被商户删除</span>
						{elseif $item['status'] == '5'}
						<span class="label label-warning">已在公众平台投放</span>
						{/if}
					</td>
					<td>{$item['quantity']}</td>
					<td>{$item['get_limit']}</td>
					<td>
						{if $item['is_display'] == 1}
							<span class="label label-success">上架中</span>
						{else}
							<span class="label label-danger">已下架</span>
						{/if}
					</td>
					<td style="text-align:right;">
						{if false}
						<a href="javascript:;" onclick="util.ajaxshow('{php echo $this->createWeburl('couponmanage', array('op' => 'selfconsume', 'id' => $item['id']))}')" class="btn {if $item['is_selfconsume'] == 1}btn-danger{else}btn-success{/if} btn-sm toggle-selfconsume" title="自助核销">{if $item['is_selfconsume'] == 1}关闭自助核销{else}开启自助核销{/if}</a>
						{/if}
						<a href="#put-coupon" data-toggle="modal" data-cid={$item['id']} class="btn btn-default btn-sm js-publish">投放</a>
						<a href="javascript:;" class="btn btn-default btn-sm change_quantity" data-id="{$item['id']}">修改库存</a>
						<a href="javascript:;" onclick="util.ajaxshow('{php echo $this->createWeburl('couponmanage', array('op' => 'toggle', 'id' => $item['id']))}')" class="btn btn-default btn-sm toggle-display" title="上架/下架">{if $item['is_display'] == 1}下架{else}上架{/if}</a>
						<a href="{php echo $this->createWeburl('couponmanage', array('op' => 'detail', 'id' => $item['id']))}" class="btn btn-success btn-sm" title="查看详情">查看详情</a>
						<a href="{php echo $this->createWeburl('couponconsume', array('couponid' => $item['id'], 'status' => '0'))}"  class="btn btn-default btn-sm" title="领取记录">领取记录</a>
						<a href="{php echo $this->createWeburl('couponmanage', array('op' => 'delete', 'id' => $item['id']))}"  class="btn btn-default btn-sm" title="删除" onclick="if(!confirm('删除后将不可恢复，确定删除吗?')) return false;">删除</a>
					</td>
				</tr>
				{/loop}
			</tbody>
		</table>
	</div>
</div>
{if COUPON_TYPE == WECHAT_COUPON}
<a class="btn btn-success js-sync pull-left" onclick="util.ajaxshow('{php echo $this->createWeburl('couponmanage', array('op' => 'sync', 'type' => 1))}')">更新全部卡券最新状态</a>&nbsp;&nbsp;
<!-- <a class="btn btn-success" ng-click="download(0);">同步卡券信息</a> -->
{/if}
<script type="text/javascript">
require(['jquery.qrcode'], function(){
	$('#switchCP').change(function() {
		var status = this.checked ? 2 : 1;
		$.post("{php echo $this->createWeburl('couponmanage', array('op' => 'status'));}", {status:status}, function(data){
			data = $.parseJSON(data);
			if(data.message.errno != 0) {
				util.message('操作失败, 请稍后重试.')
			} else {
				util.message('操作成功', location.href, 'success');
			}
		});
	});
	$('.js-select-coupon').click(function() {
		type = $('#cardtype-modal input[type=radio]:checked').val() ? $('#cardtype-modal input[type=radio]:checked').val() : 1;
		location.href = '{php echo $this->createWeburl('couponmanage', array('op' => 'post'))}&type=' + type;
	});
	$(document).on('click', '.js-publish', function() {
		cid = $(this).data('cid');
		$.post("{php echo $this->createWeburl('couponmanage', array('op' => 'publish'))}", {'cid' : cid}, function(data) {
			var data = $.parseJSON(data);
			if (data.message.errno == '0') {
				var coupon = data.message.message;
				console.log(coupon);
				$('.js-qrcode-record-total').html(coupon.total);
				var record = coupon.record;
				if (record) {
					$('.js-qrcode-record').html('');
					for (i in record) {
						$('.js-qrcode-record').append('<tr><td><img src="'+record[i].avatar+'" width="50" /></td><td><a href="#">'+record[i].nickname+'</a></td><td><a href="#">'+record[i].addtime+'</a></td></tr>');
					}
				}
				if (coupon.url) {
					var url = coupon.url;
					$('.js-qrcode-block').html('').qrcode({
						render: 'canvas',
						width: 300,
						height: 300,
						text: url,
					});
				} else if(coupon.coupon.url) {
					var url = coupon.coupon.url;
					$('.js-qrcode-block img').remove();
					$('.js-qrcode-block').append('<img src="'+url+'"/>');
				}
				
			} else {
				$('#put-coupon').modal('hide');
				util.message(data.message.message);
			}
		});
	});
	$('#add_coupon').click(function() {
		$('#cardtype-modal').modal(); 
	});
	$('.change_quantity').click(function() {
		coupon_id = $(this).data('id');
		$('input[name="quantity_coupon_id"]').val(coupon_id);
		$('#quantity-modal').modal();
	})
});
</script>
{/if}

{if $op == 'post'}
<link rel="stylesheet" href="../addons/wn_storex/template/style/css/membercard.css">
<div class="main" style="width:1200px;" id="couponmanage">
	<ul class="nav nav-tabs">
		<li {if $_GPC['do'] == 'couponmanage' }class="active" {/if}><a href="{php echo $this->createWeburl('couponmanage', array('op' => 'display'))}">卡券管理</a></li>
		<li {if $_GPC['do'] == 'couponexchange' && $_GPC['op'] == 'display' }class="active" {/if}><a href="{php echo $this->createWeburl('couponexchange', array('op' => 'display'))}">卡券兑换</a></li>
		<li {if $_GPC['do'] == 'couponconsume' && $_GPC['op'] == 'display' }class="active" {/if}><a href="{php echo $this->createWeburl('couponconsume', array('op' => 'display'))}">卡券核销</a></li>
	</ul>
	<div class="page-header clearfix">
		<h4 class="pull-left">卡券管理</h4>
		<div class="pull-right">
			<a href="{php echo $this->createWeburl('couponmanage', array('op' => 'display'))}" class="btn btn-primary we7-padding-horizontal">返回列表</a>
		</div>
	</div>
	<div class="panel panel-default" id="step1">
		<div class="panel-heading">
			{{coupon_label.title}}
		</div>
		<div class="app">
			<div class="app-preview">
				<div class="app-header"></div>
				<div class="app-content">
					<div class="title">
						<h1><span>{{coupon_label.title}}</span></h1>
					</div>
					<div class="card_section area" style="position: relative">
						<div class="shop-panel" id="color-purview" :style="{'background-color': params.color_value}">
							<div class="logo-area">
								<span class="logo pull-left"><img :src="params.logo_url" alt=""/></span>
								<div class="pull-left" style="height:38px;line-height:38px" id="brand_name">{{params.brand_name ? params.brand_name : '商户信息'}}</div>
								<div class="clear"></div>
							</div>
							<div class="msg-area">
								<div class="tick-msg">
									<p><b id="title-purview">{{params.title ? params.title : coupon_label.title + '标题'}}</b></p>
									<p id="sub-title-purview">{{params.sub_title ? params.sub_title : coupon_label.title + '副标题'}}</p>
								</div>
								<p id="sub-time-purview" style="text-align: center">有效期:{{params.time_limit.start}} ~ {{params.time_limit.end}}</p>
							</div>
							<div class="deco"></div>
							<div class="cicon">
								<a href="javascript:;" data-id="form1"><i class="fa fa-pencil"></i></a>
							</div>
						</div>
					</div>
					<div class="card-dispose area">
						<div class="unset" id="destroy_title">
							<p>销券设置</p>
						</div>
						<div class="destroy_type_preview">
							<div class="barcode-area code_preview_3" v-if="params.code_type == 3">
								<div class="barcode"></div>
								<p class="code_num">1513-2290-1878</p>
							</div>
							<div class="qrcode-area code_preview_2" v-if="params.code_type == 2">
								<div class="qrcode"></div>
								<p class="code_num">1513-2290-1878</p>
							</div>
							<div class="sn-area code_preview_1" v-if="params.code_type == 1">1513-2290-1878</div>
							<p style="text-align: center" id="notice-purview">请在付款时出示此券</p>
						</div>
						<div class="cicon">
							<a href="javascript:;" data-id="form2"><i class="fa fa-pencil"></i></a>
						</div>
					</div>
					<div class="shop-detail">
						<ul class="list">
							<li>
								<div class="li-panel area">
									<div class="li-content">{{coupon_label.title}}设置</div>
									<span class="ricon fa fa-angle-right"></span>
									<div class="cicon">
										<a href="javascript:;" data-id="form3"><i class="fa fa-pencil"></i></a>
									</div>
								</div>
							</li>
							<li>
								<div class="li-panel area">
									<div class="li-content">适用门店</div>
									<span class="ricon fa fa-angle-right"></span>
									<div class="cicon">
										<a href="javascript:;" data-id="form4"><i class="fa fa-pencil"></i></a>
									</div>
								</div>
							</li>
						</ul>
					</div>
					<div class="shop-detail">
						<ul class="list">
							<li style="display:none;">
								<div class="li-panel">
									<div class="li-content">立即使用</div>
									<span class="ricon">系统已实现</span>
								</div>
							</li>
							<li>
								<div class="li-panel area" style="border-bottom: none">
									<div class="li-content" id="promotion_url_name">{{params.promotion_url_name}}</div>
									<div class="ricon"><span id="promotion_url_sub_title">{{params.promotion_url_sub_title}} </span><i class="fa fa-angle-right"></i></div>
									<div class="cicon">
										<a href="javascript:;" data-id="form6"><i class="fa fa-pencil"></i></a>
									</div>
								</div>
							</li>
						</ul>
					</div>
				</div>
			</div>
			<div class="app-side">
				<div class="editor">
					<div>
						<div class="app-header-setting">
							<div class="arrow-left"></div>
							<div class="app-header-setting-inner">
								<div class="panel panel-default">
									<div class="wn-card-menu">
										<ul class="nav nav-tabs">
											<li class="active" style=""><a href="#form1" aria-controls="cardBasic" role="tab" data-toggle="tab">券面信息</a></li>
											<li class="" style=""><a href="#form2" aria-controls="cardActivity" role="tab" data-toggle="tab">领券设置</a></li>
											<li ><a href="#form3" aria-controls="cardRecharge" role="tab" data-toggle="tab">{{coupon_label.title}}详情</a></li>
											<li {if COUPON_TYPE == WECHAT_COUPON}style="display:none;"{/if}><a href="#form4" aria-controls="cardNums" role="tab" data-toggle="tab">服务信息</a></li>
											<li><a href="#form6" aria-controls="cardTimes" role="tab" data-toggle="tab">营销入口</a></li>
										</ul>
									</div>
									<div class="tab-content">
										<div class="panel-body form-horizontal tab-pane fade in active" id="form1">
											<div class="wn-edit-head">
												券面信息
											</div>
											<div class="form-group">
												<label class="col-xs-12 col-sm-3 col-md-2 control-label">是否上架</label>
												<div class="col-sm-9 col-xs-12">
													<label class="radio-inline">
														<input type="radio" value="1" name="is_display" checked v-model="params.status" /> 上架
													</label>
													<label class="radio-inline">
														<input type="radio" value="0" name="is_display" v-model="params.status" /> 下架
													</label>
												</div>
											</div>
											<div class="form-group" style="display:none;">
												<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 适用模块</label>
												<div class="col-sm-9 col-xs-12">
													<a href="#modules-modal" class="btn btn-default js-modules-modal" data-toggle="modal">选择模块</a>
													<input type="hidden" name="module-select" value="" autocomplete="off" />
													<div class="js-modules-contain clearfix"></div>
													<div class="help-block">确定该券的适用模块，不选择则为全部可用</div>
												</div>
											</div>
											<div class="form-group">
												<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> 商户LOGO</label>
												<div class="col-sm-9 col-xs-12" id="logo_upload">
													<span @click="addLogo()" class="form-control-static"><i class="fa fa-plus-circle green"></i>&nbsp;选择图片</span>
													<div style="margin-top: 0.5em;" class="input-group"><img width="150" class="img-responsive img-thumbnail" :src="params.logo_url"> <em title="删除这张图片" @click="params.logo_url = ''" style="position:absolute; top: 0px; right: -14px" class="close">×</em>
													</div>	
													<div class="help-block">商户LOGO大小不超过1M。像素为：300*300。仅支持JPG格式</div>
												</div>
											</div>
											<div class="form-group">
												<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> 商户名称</label>
												<div class="col-sm-9 col-xs-12">
													<input type="text" class="form-control" name="brand_name" v-model="params.brand_name" />
													<div class="help-block">商户名字,字数上限为12个汉字。 </div>
												</div>
											</div>
											<div class="form-group">
												<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> 卡券颜色</label>
												<div class="col-sm-9 col-xs-12 coupon-color" style="position: relative;width:200px;"  :class="{'open': coupon_colors.status}">
													<div class="input-group" style="width:200px;">
														<input type="text" class="form-control" name="" value="" v-model="params.color"/>
														<span class="input-group-addon" style="width:35px;" :style="{'background-color': params.color_value}"></span>
														<span class="input-group-btn">
															<button class="btn btn-default" type="button" @click="coupon_colors.status = !coupon_colors.status">选择颜色</button>
														</span>
													</div>
													<div class="dropdown-menu" style="padding:6px 0 0 6px;width:185px;position: absolute;top:35px;left:15px">
														<ul style="padding:0">
															<li style="padding: 0;margin-right:5px;margin-bottom:5px;width:30px;height:30px;float:left;list-style: none;" v-for="(colors, key) in coupon_colors.coupon_colors" :style="{'background-color': colors}" @click="selectColor(colors, key)"></li>
														</ul>
													</div>
												</div>
											</div>
											<div class="form-group">
												<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> {{coupon_label.title}}标题</label>
												<div class="col-sm-9 col-xs-12">
													<input type="text" class="form-control" name="title" v-model="params.title" />
													<div class="help-block">建议填写{{coupon_label.title}}“减免金额”及自定义内容，描述卡券提供的具体优惠。不超过9个字符</div>
												</div>
											</div>
											<div class="form-group">
												<label class="col-xs-12 col-sm-3 col-md-2 control-label"> {{coupon_label.title}}副标题(可选)</label>
												<div class="col-sm-9 col-xs-12">
													<input type="text" class="form-control" name="sub_title" v-model="params.sub_title" />
													<div class="help-block">不超过18个字符</div>
												</div>
											</div>
											{if $type == COUPON_TYPE_DISCOUNT}
											<div class="form-group">
												<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> 折扣额度</label>
												<div class="col-sm-9 col-xs-12">
													<div class="input-group">
														<input type="text" class="form-control" name="discount" v-model="params.discount" />
														<span class="input-group-addon">折</span>
													</div>
													<div class="help-block">表示打折额度（百分比）。填30就是3折。填写整数</div>
												</div>
											</div>
											{elseif $type == COUPON_TYPE_CASH}
											<div class="form-group">
												<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> 减免金额</label>
												<div class="col-sm-9 col-xs-12">
													<div class="input-group">
														<span class="input-group-addon">满</span>
														<input type="text" class="form-control" name="least_cost" v-model="params.least_cost" />
														<span class="input-group-addon">减</span>
														<input type="text" class="form-control" name="reduce_cost" v-model="params.reduce_cost" />
														<span class="input-group-addon">元</span>
													</div>
												</div>
											</div>
											{elseif $type == COUPON_TYPE_GIFT}
											<div class="form-group">
												<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> 礼品券详情</label>
												<div class="col-sm-9 col-xs-12">
													<textarea name="gift" id="gift" class="form-control" rows="7" v-model="params.gift"></textarea>
												</div>
											</div>
											{elseif $type == COUPON_TYPE_GROUPON}
											<div class="form-group">
												<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> 团购券详情</label>
												<div class="col-sm-9 col-xs-12">
													<textarea name="deal_detail" id="deal_detail" class="form-control" rows="7" v-model="params.deal_detail"></textarea>
												</div>
											</div>
											{elseif $type == COUPON_TYPE_GENERAL}
											<div class="form-group">
												<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> 优惠券详情</label>
												<div class="col-sm-9 col-xs-12">
													<textarea name="default_detail" id="default_detail" class="form-control" rows="7" v-model="params.default_detail"></textarea>
												</div>
											</div>
											{/if}
											<div class="form-group">
												<label class="col-xs-12 col-sm-3 col-md-2 control-label" style="padding-top:15px"> 有效期</label>
												<div class="col-sm-9 col-xs-12">
													<div class="radio">
														<div class="col-sm-3" style="padding-top:6px"><label><input type="radio" value="1" name="time_type" checked v-model="params.time_type"/>固定日期 </label></div>
														<button class="btn btn-default daterange daterange-date" type="button" v-daterangepicker="{'object': params, 'key': 'time_limit'}"><span class="date-title">{{params.time_limit.start}} 至 {{params.time_limit.end}}</span> <i class="fa fa-calendar"></i></button>
													</div>
													<div class="radio">
														<div class="col-sm-3" style="padding-top:6px"><label><input type="radio" value="2" name="time_type" v-model="params.time_type"/>领取后 </label></div>
														<div class="col-sm-3" style="margin-left:-15px">
															<select name="deadline" id="deadline" class="form-control" v-model="params.deadline">
																<?php
																for($i=0; $i<=90; $i++) {
																	if(!$i) $n = '当'; else $n = $i;
																	echo '<option value="'.$i.'">'.$n.'天</option>';
																}
																?>
															</select>
														</div>
														<div class="col-sm-3" style="padding-top:6px">有效,有效期</div>
														<div class="col-sm-3" style="margin-left:-15px">
															<select name="limit" id="limit" class="form-control" v-model="params.limit">
																<?php
																for($i=1; $i<=90; $i++) {
																	echo '<option value="'.$i.'">'.$i.'天</option>';
																}
																?>
															</select>
														</div>

													</div>
												</div>
											</div>
										</div>
										<div class="panel-body form-horizontal tab-pane fade in" id="form2">
											<div class="wn-edit-head">
												领券设置
											</div>
											<div class="form-group">
												<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> 库存</label>
												<div class="col-sm-9 col-xs-12">
													<div class="input-group">
														<input type="text" class="form-control" name="quantity" v-model="params.quantity"/>
														<span class="input-group-addon">份</span>
													</div>
													<div class="help-block">库存只能是大于0的数字</div>
												</div>
											</div>
											<div class="form-group">
												<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 领券限制</label>
												<div class="col-sm-9 col-xs-12">
													<div class="input-group">
														<input type="text" class="form-control" name="get_limit" v-model="params.get_limit"/>
														<span class="input-group-addon">份</span>
													</div>
													<div class="help-block">默认领券限制为1</div>
												</div>
											</div>
											{if COUPON_TYPE == WECHAT_COUPON}
											<div class="form-group">
												<label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
												<div class="col-sm-9 col-xs-12">
													<div class="checkbox">
														<label><input type="checkbox" name="can_share" value="1" checked v-model="params.can_share"/> 用户可以分享领券链接</label>
													</div>
													<div class="checkbox">
														<label><input type="checkbox" name="can_give_friend" value="1" checked v-model="params.can_give_friend"/> 用户领券后可转赠其他好友</label>
													</div>
												</div>
											</div>
											<h4 style="margin-top:20px;">销券设置</h4>
											<div class="form-group">
												<label class="col-xs-12 col-sm-3 col-md-2 control-label">销券方式</label>
												<div class="col-sm-9 col-xs-12">
													<div class="radio">
														<label><input type="radio"  class="" name="code_type" value="1" v-model="params.code_type"/> 仅卡券号</label>
														<div class="help-block">只显示卡券号，验证后可进行销券</div>
													</div>
													<div class="radio">
														<label><input type="radio"  class="" name="code_type" value="2" v-model="params.code_type"/> 二维码</label>
														<div class="help-block">包含卡券信息的二维码，扫描后可进行销券</div>
													</div>
													<div class="radio">
														<label><input type="radio"  class="" name="code_type" value="3" checked v-model="params.code_type"/> 条形码</label>
														<div class="help-block">包含卡券信息的条形码，扫描后可进行销券</div>
													</div>
												</div>
											</div>
											<div class="form-group">
												<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> 操作提示</label>
												<div class="col-sm-9 col-xs-12">
													<input type="text" class="form-control" name="notice" id="notice" value="请在付款时出示此券"/>
													<div class="help-block">建议引导用户到店出示卡券，由店员完成核销操作。不超过16个字符</div>
												</div>
											</div>
											{/if}
											{if false}
											<div class="form-group">
												<label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
												<div class="col-sm-9 col-xs-12">
													<div class="checkbox">
														<label><input type="checkbox" name="can_share" value="1" checked /> 用户可以分享领券链接</label>
													</div>
													<div class="checkbox">
														<label><input type="checkbox" name="can_give_friend" value="1" checked /> 用户领券后可转赠其他好友</label>
													</div>
												</div>
											</div>
											<h4 style="margin-top:20px;">销券设置</h4>
											<div class="form-group">
												<label class="col-xs-12 col-sm-3 col-md-2 control-label">销券方式</label>
												<div class="col-sm-9 col-xs-12">
													<div class="radio">
														<label><input type="radio"  class="" name="code_type" value="1"/> 仅卡券号</label>
														<div class="help-block">只显示卡券号，验证后可进行销券</div>
													</div>
													<div class="radio">
														<label><input type="radio"  class="" name="code_type" value="2"/> 二维码</label>
														<div class="help-block">包含卡券信息的二维码，扫描后可进行销券</div>
													</div>
													<div class="radio">
														<label><input type="radio"  class="" name="code_type" value="3" checked/> 条形码</label>
														<div class="help-block">包含卡券信息的条形码，扫描后可进行销券</div>
													</div>
												</div>
											</div>
											<div class="form-group">
												<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> 操作提示</label>
												<div class="col-sm-9 col-xs-12">
													<input type="text" class="form-control" name="notice" id="notice" value="请在付款时出示此券"/>
													<div class="help-block">建议引导用户到店出示卡券，由店员完成核销操作。不超过16个字符</div>
												</div>
											</div>
											{/if}
										</div>
										<div class="panel-body form-horizontal tab-pane fade in" id="form3">
											<div class="wn-edit-head">
												{{coupon_label.title}}详情
											</div>
											<div class="form-group">
												<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> 使用须知</label>
												<div class="col-sm-9 col-xs-12">
													<textarea name="description" id="description" class="form-control" rows="10" v-model="params.description"></textarea>
												</div>
											</div>
											<div class="form-group">
												<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> 客服电话</label>
												<div class="col-sm-9 col-xs-12">
													<input type="text" class="form-control" name="service_phone" v-model="params.service_phone"/>
													<div class="help-block">手机或固话</div>
												</div>
											</div>
										</div>
										<div class="panel-body form-horizontal tab-pane fade in" id="form4">
											<div class="wn-edit-head">
												服务信息
											</div>
											<input type="hidden" name="location-select" value="" autocomplete="off"/>
											<input type="hidden" name="groups" value="" autocomplete="off"/>
											<div class="form-group">
												<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 适用店铺</label>
												<div class="col-sm-9 col-xs-12">
													<label class="radio"><a href="#location-store-modal" data-toggle="modal" class="js-location-store-modal">选择适用店铺</a></label>
													<div v-if="params.location_select">
														<span class="label label-success" style="margin-left:5px;" v-for="location in params.location_select">{{location.title}}</span>
													</div>
													<div class="help-block">默认为适用于全部店铺</div>
												</div>
											</div>
											{if false}
											<div class="form-group">
												<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger">*</span> 可用会员组</label>
												<div class="col-sm-9 col-xs-12">
													<label class="radio"><a href="#groups-modal" data-toggle="modal" class="js-groups-modal">选择可用会员组</a></label>
													<div class="js-groups-contain"></div>
													<div class="help-block">默认为全部用户组可用</div>
												</div>
											</div>
											{/if}
										</div>
										<div class="panel-body form-horizontal tab-pane fade in" id="form6">
											<div class="wn-edit-head">
												营销入口
											</div>
											<div class="form-group">
												<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 营销场景的自定义入口名称</label>
												<div class="col-sm-9 col-xs-12">
													<input type="text" class="form-control" name="promotion_url_name" v-model="params.promotion_url_name"/>
													<div class="help-block">如：店铺。</div>
												</div>
											</div>
											<div class="form-group">
												<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 跳转链接</label>
												<div class="col-sm-9 col-xs-12">
													<input type="text" class="form-control" name="promotion_url" v-model="params.promotion_url"/>
													<div class="help-block">入口跳转链接地址。需要以"http://"或"https://"开头</div>
												</div>
											</div>
											<div class="form-group">
												<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 营销入口右侧的提示语</label>
												<div class="col-sm-9 col-xs-12">
													<input type="text" class="form-control" name="promotion_url_sub_title" v-model="params.promotion_url_sub_title"/>
													<div class="help-block">营销入口右侧的提示语.不超过6个汉字</div>
												</div>
											</div>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
			<nav class="navbar wn-card-sumbit navbar-fixed-bottom" role="navigation">
				<div class="container">
					<button type="submit" class="btn btn-primary" @click = "submit">提交</button>
					<input type="hidden" name="token" value="{$_W['token']}" />
				</div>
			</nav>
		</div>
	</div>
	<div class="modal fade" id="location-store-modal" tabindex="-1" role="dialog" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
					<h4 class="modal-title" id="myModalLabel">选择适用门店</h4>
				</div>
				<div class="modal-body clearfix form-horizontal">
					<table class="table tb" style="min-width:568px;">
						<thead>
						<tr>
							<th style="width: 35px;" class="text-center">选择</th>
							<th style="width: 50px;">店铺logo</th>
							<th style="width: 70px;">店铺名称</th>
							<th style="width: 100px;">地址</th>
						</tr>
						</thead>
						<tbody>
							<tr v-if="store_lists" v-for="store in store_lists">
								<td class="text-center"><input type="checkbox" :id="store.id" :value="store" v-model="params.location_select"></td>
								<td><label for="" style="font-weight:normal;" class="name"></label><img :src="store.thumb" width="50px;"></td>
								<td><label style="font-weight:normal;" class="name"></label>{{store.title}}</td>
								<td><label class="label label-info address"></label>{{store.address_info}}</td>
							</tr>
							<tr v-if="!store_lists">
								<td align="center" colspan="3">没有有效的门店。你可以 <a href="{php echo $this->createWeburl('storelist', array('op' => 'post'));}" target="_blank">添加门店</a> 或 <a href="{php echo $this->createWeburl('storelist', array('op' => 'import'));}" target="_blank">更新门店</a></td>
							</tr>
						</tbody>
					</table>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-primary" data-dismiss="modal">确定</button>
				</div>
			</div>
		</div>
	</div>
</div>
<div id="footer-location" class="hide">
	<span name="submit" id="submit" class="pull-right btn btn-primary" @click="submit()">保存</span>
</div>
<!--选择门店弹出窗-->
<script type="text/javascript">

	require(['vue'], function(Vue) {
		var coupon_label = {php echo $coupon_label;};
		var coupon_colors = {php echo json_encode($coupon_colors);};
		var type = {php echo $type};
		var store_lists = {php echo json_encode($store_lists);};
		var promotion_url = "{php echo murl('entry', array('do' => 'display', 'm' => 'wn_storex'), true, true);}";
		var starttime = "{$starttime}";
		var endtime = "{$endtime}";
		var app = new Vue({
			el: '#couponmanage',
			data: {
				params: {
					'logo_url': '',
					'brand_name': '',
					'title': '',
					'sub_title': '',
					'status': 1,
					'time_type': 1,
					'time_limit': {
						'start': starttime,
						'end': endtime
					},
					'deadline': 0,
					'limit': 1,
					'color': 'Color082',
					'color_value': '#a9d92d',
					'discount': 70,
					'quantity': 300,
					'get_limit': 1,
					'promotion_url': promotion_url,
					'promotion_url_name': '店铺',
					'promotion_url_sub_title': '点击进入',
					'location_select': [],
					'can_share': 1,
					'can_give_friend': 1,
					'code_type': 3,
					'type': type,
				},
				coupon_label: coupon_label,
				coupon_colors: {
					status: false,
					coupon_colors: coupon_colors
				},
				store_lists: store_lists
			},
			directives: {
				'daterangepicker': {
					bind: function (el, binding, vnode) {
						var self = this;
						var value = binding.value; // 传递给指令的值
						require(['daterangepicker', 'jquery'], function($, $){
							$('.daterange.daterange-date').daterangepicker({
								startDate: starttime,
								endDate: endtime,
								format: "YYYY-MM-DD",
							}, function(start, end){
								start = start.toDateStr();
								end = end.toDateStr();
								app.$set(value.object, value.key, {start, end});
							});
						});
					}
				}
			},
			methods: {
				addLogo() {
					const self = this;
					require(['fileUploader'], function(uploader) {
						uploader.show(function(img) {
							self.params.logo_url = img.url;
						}, {
							'direct': true,
							'multiple': false
						});
					});
				},
				selectColor(colors, key) {
					const self = this;
					self.params.color = key;
					self.params.color_value = colors;
					self.coupon_colors.status = !self.coupon_colors.status;
				},
				submit() {
					$.post("{php echo $this->createWeburl('couponmanage', array('op' => 'post'));}", {params:this.params}, function(data){
						data = $.parseJSON(data);
						console.dir(data);
						if (data.message.errno != '0') {
							util.message(data.message.message, '', 'error');
						} else {
							util.message('添加成功', data.redirect, 'success');
						}
					});
				}
			}
		});
	});
</script>
{/if}

{if $op == 'detail'}
<div class="main">
	<form action="" method="post" id="form-location" class="form-horizontal" enctype="multipart/form-data">
		<div class="panel panel-default" id="step1">
			<div class="panel-heading">
				{$coupon_info['coupon_label']['title']}
			</div>
			<div class="panel-body">
				<div class="pull-left" style="width:320px;background:#F4F5F9;margin-right:20px;border:1px solid #E7E7EB">
					<div class="card-title">{$coupon_info['coupon_label']['title']}</div>
					<div class="card_section" style="position: relative">
						<div class="shop-panel" id="color-purview" style="background:{$coupon_colors[$coupon_info['color']]}">
							<div class="logo-area">
								<span class="logo pull-left"><img src="{$coupon_info['logo_url']}" alt=""/></span>
								<div class="pull-left" style="height:38px;line-height:38px">{$coupon_info['brand_name']}</div>
								<div class="clear"></div>
							</div>
							<div class="msg-area">
								<div class="tick-msg">
									<p><b id="title-purview">{$coupon_info['title']}</b></p>
									<p id="sub-title-purview">{$coupon_info['sub_title']}</p>
								</div>
								<p id="sub-time-purview" style="text-align: center">
									{$coupon_info['extra_date_info']}
								</p>
							</div>
							<div class="deco"></div>
							<div class="cicon">
								<a href="javascript:;" data-id="form1"><i class="fa fa-pencil"></i></a>
							</div>
						</div>
					</div>
					<div class="card-dispose">
						<div class="destroy_type_preview">
							{if $coupon_info['code_type'] == 3}
							<div class="barcode-area code_preview_3">
								<div class="qrcode"></div>
								<p class="code_num">1513-2290-1878</p>
							</div>
							{elseif $coupon_info['code_type'] == 2}
							<div class="qrcode-area code_preview_2">
								<div class="qrcode"></div>
								<p class="code_num">1513-2290-1878</p>
							</div>
							{else}
							<div class="sn-area code_preview_1">1513-2290-1878</div>
							{/if}
							<p style="text-align: center" id="notice-purview">{$coupon_info['notice']}</p>
						</div>
						<div class="cicon">
							<a href="javascript:;" data-id="form2"><i class="fa fa-pencil"></i></a>
						</div>
					</div>
					<div class="shop-detail">
						<ul class="list">
							<li>
								<div class="li-panel">
									<div class="li-content">{$coupon_title}设置</div>
									<span class="ricon fa fa-angle-right"></span>
									<div class="cicon">
										<a href="javascript:;" data-id="form3"><i class="fa fa-pencil"></i></a>
									</div>
								</div>
							</li>
							<li>
								<div class="li-panel">
									<div class="li-content">适用门店</div>
									<span class="ricon">{php echo count($coupon_info['location_id_list'])}家</span>
									<div class="cicon">
										<a href="javascript:;" data-id="form4"><i class="fa fa-pencil"></i></a>
									</div>
								</div>
							</li>
						</ul>
					</div>
					<div class="shop-detail">
						<ul class="list">
							<li>
								<div class="li-panel">
									<div class="li-content">立即使用</div>
									<span class="ricon">系统已实现</span>
								</div>
							</li>
							{if !empty($coupon_info['promotion_url_name'])}
							<li>
								<div class="li-panel" style="border-bottom: none">
									<div class="li-content">{$coupon_info['promotion_url_name']}</div>
									<div class="ricon"><span>{$coupon_info['promotion_url_sub_title']}</span><i class="fa fa-angle-right"></i></div>
									<div class="cicon">
										<a href="javascript:;" data-id="form6"><i class="fa fa-pencil"></i></a>
									</div>
								</div>
							</li>
							{/if}
						</ul>
					</div>
				</div>
				<div class="pull-left alert form" style="width:700px;position:relative;display:block;" id="form1">
					<h4>券面信息</h4>
					<div class="form-group marbot0">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 卡券类型</label>
						<div class="col-sm-9 col-xs-12">
							<p class="form-control-static">{$coupon_info['coupon_label']['title']}	</p>
						</div>
					</div>
					<div class="form-group marbot0">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 卡券id</label>
						<div class="col-sm-9 col-xs-12">
							<p class="form-control-static">{$coupon_info['card_id']}</p>
						</div>
					</div>
					<div class="form-group marbot0">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 卡券标题</label>
						<div class="col-sm-9 col-xs-12">
							<p class="form-control-static">{$coupon_info['title']}</p>
						</div>
					</div>
					<div class="form-group marbot0">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 卡券副标题</label>
						<div class="col-sm-9 col-xs-12">
							<p class="form-control-static">{if !empty($coupon_info['sub_title'])}{$coupon_info['sub_title']}{else}无{/if}</p>
						</div>
					</div>
					{if $coupon_info['type'] == COUPON_TYPE_DISCOUNT}
					<div class="form-group marbot0">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 卡券额度</label>
						<div class="col-sm-9 col-xs-12">
							<p class="form-control-static">{$coupon_info['extra_instruction']}</p>
						</div>
					</div>
					{elseif $coupon_info['type'] == COUPON_TYPE_CASH}
					<div class="form-group marbot0">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 减免金额</label>
						<div class="col-sm-9 col-xs-12">
							<p class="form-control-static">{$coupon_info['detail']['reduce_cost']}元</p>
						</div>
					</div>
					<div class="form-group marbot0">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 抵扣条件</label>
						<div class="col-sm-9 col-xs-12">
							<p class="form-control-static">满{$coupon_info['detail']['least_cost']}元可用</p>
						</div>
					</div>
					{/if}
					<div class="form-group marbot0">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 有效期</label>
						<div class="col-sm-9 col-xs-12">
							<p class="form-control-static">
							{$coupon_info['extra_date_info']}
							</p>
						</div>
					</div>
					<div class="form-group marbot0">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 商户名称</label>
						<div class="col-sm-9 col-xs-12">
							<p class="form-control-static">
								{$coupon_info['brand_name']}
							</p>
						</div>
					</div>
					<h4>投放信息</h4>
					<div class="form-group marbot0">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 库存</label>
						<div class="col-sm-9 col-xs-12">
							<p class="form-control-static">
								{$coupon_info['quantity']}
							</p>
						</div>
					</div>
					<div class="form-group marbot0">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 领取限制</label>
						<div class="col-sm-9 col-xs-12">
							<p class="form-control-static">
								每个用户限领{$coupon_info['get_limit']}张
							</p>
						</div>
					</div>
					<div class="form-group marbot0">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 销券条码</label>
						<div class="col-sm-9 col-xs-12">
							<p class="form-control-static">
								{if $coupon_info['code_type'] == 1}
								卡号
								{elseif $coupon_info['code_type'] == 2}
								二维码
								{else}
								条形码
								{/if}
							</p>
						</div>
					</div>
					{if false}
					<div class="form-group marbot0">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 操作提示</label>
						<div class="col-sm-9 col-xs-12">
							<p class="form-control-static">
								{$coupon_info['notice']}
							</p>
						</div>
					</div>
					
					<div class="form-group marbot0">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 分享设置</label>
						<div class="col-sm-9 col-xs-12">
							<p class="form-control-static">
								{if $coupon_info['can_share']}用户可以分享领券链接{else}用户不能分享领券链接{/if}
							</p>
						</div>
					</div>
					<div class="form-group marbot0">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 转赠设置</label>
						<div class="col-sm-9 col-xs-12">
							<p class="form-control-static">
								{if $coupon_info['can_give_friend']}用户领券后可转赠其他好友{else}用户领券后不能转赠其他好友{/if}
							</p>
						</div>
					</div>
					{/if}
					<h4>{$coupon_title}详情</h4>
					<div class="form-group marbot0">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 使用须知</label>
						<div class="col-sm-9 col-xs-12">
							<p class="form-control-static">
								{$coupon_info['description']}
							</p>
						</div>
					</div>
					<div class="form-group marbot0">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label"><span class="text-danger"></span> 客服电话</label>
						<div class="col-sm-9 col-xs-12">
							<p class="form-control-static">
								{$coupon_info['service_phone']}
							</p>
						</div>
					</div>
					<h4>适用门店</h4>
					{if !empty($coupon_info['location_id_list'])}
						{loop $coupon_info['location_id_list'] $location}
							<span class="label label-success">{$location['title']}</span>
						{/loop}
					{else}
					适用于全部门店
					{/if}
				</div>
			</div>
		</div>
		<div class="form-group col-sm-12">
			<span class="btn btn-primary col-lg-1" onclick="javascript:history.go(-1)">返回</span>
		</div>
	</form>
</div>
{/if}
{template 'common/footer'}
